﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="FoodBook.aspx.cs" Inherits="FoodBook" Title="Food Book" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
<telerik:RadCodeBlock ID="FoodBood" runat="server">
    <script type="text/javascript">
        function OpenPositionedWindow(oButton, url, windowName) {
            var oWnd = window.radopen(url, windowName);
        }
        function openRadWindow(FoodBookID) {
            var dialogs = $find("<%=InfoBox.ClientID %>").get_windows();
            var detailPage = dialogs[0];
            detailPage.setUrl("FoodBookDetails.aspx?FoodBookID="+FoodBookID);
            detailPage.center();
            detailPage.show();
        }
        function ShowInsertForm()
        {
            var oWnd = radopen("FoodBookDetails_Insert.aspx" , "RadWindow1");
            oWnd.setSize(700, 500);
            oWnd.center();
        }        
    </script>
</telerik:RadCodeBlock>
    <table width="830px" border="0" bgcolor="White" style="height: 67px; background-image: url('Images/bg-snippet.png');">
        <tr>
            <td align="center" style="height: 25px">
                <asp:Label ID="Label1" runat="server" ForeColor="Red" Text="Bạn Chưa Nhập tên Món Ăn !!!"
                    Visible="False"></asp:Label>
                <asp:TextBox ID="txtSearch" runat="server" value="Nhập Tên Món Ăn Cần Tìm..." onblur="if(this.value=='') this.value='Nhập Tên Món Ăn Cần Tìm...';"
                    onfocus="if(this.value=='Nhập Tên Món Ăn Cần Tìm...') this.value='';" Style="width: 230px" />
                <asp:Button ID="btnSearch" runat="server" Text="Tìm Kiếm" 
                    onclick="btnSearch_Click1"/>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <a href="#" onclick="ShowInsertForm(); return false;" 
                    style="color: #000000 ; text-transform: capitalize; text-decoration: blink;">Thêm Món Ăn Mới<img height="30px" width="30px" src= "Images/add.png" alt="no Image" border="0" /></a>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="height: 8px">
                <asp:Panel ID="Panel1" runat="server" Font-Bold="True" ForeColor="White" BackColor="White"
                    BorderStyle="None">
                </asp:Panel>
            </td>
        </tr>
    </table>
    <telerik:RadGrid ID="foodBookRG" runat="server" AutoGenerateColumns="False" AllowPaging="True"
        Skin="Office2007" GridLines="None" ShowHeader="False" Width="830px" OnNeedDataSource="foodBookRG_NeedDataSource"
        BorderStyle="None" Font-Size="14px" PageSize="8" >
        <MasterTableView DataKeyNames="FoodBookID">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <table width="100%">
                            <tr>
                                <td width="15%" align="center">
                                    <img src="Images/Foods/<%#Eval("Image") %>" alt="No Image" width="120px" height="100px" />
                                </td>
                                <td width="70%">
                                    <table width="100%">
                                        <tr>
                                            <td>
                                                <u>
                                                    <h3>
                                                        <font color="red" >
                                                            <%#Eval("Title")%></font></h3>
                                                </u>
                                                <p style="font-size:13px">
                                                    <%#Eval("ShortDescription")%></p>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <a href="#" onclick="openRadWindow('<%#Eval("FoodBookID")%>'); return false;">
                                                    <img src="Images/xemthem.jpg" alt="No Image"/>
                                                </a>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <HeaderContextMenu Skin="Office2007" EnableTheming="True">
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
        </HeaderContextMenu>
        <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" Position="TopAndBottom" />
        <FilterMenu Skin="Office2007" EnableTheming="True">
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
        </FilterMenu>
    </telerik:RadGrid>    
    <telerik:RadWindowManager ID="InfoBox" runat="server" ShowContentDuringLoad="false" VisibleStatusbar="false"
     Height="600px" Width="700px" ReloadOnShow="true" Skin="Office2007" Behaviors="Close, Move, Resize , Maximize, Minimize">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" NavigateUrl="FoodBookDetails.aspx" runat="server"
            VisibleOnPageLoad="false" Top="50" Left="50" />
        </Windows>
    </telerik:RadWindowManager>
    <%--
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px">
        <br />
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
            style="border: 0px;" />
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="foodBookRG">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="foodBookRG" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>--%>
</asp:Content>
